﻿@{
    ViewBag.Title = "仓库中的商品";
    Layout = "~/Views/Shared/_MemberCenterLayout.cshtml";
}
@section Styles
{
    <style type="text/css">
        .mytaobao-bd a
        {
            color: #0579C6;
            text-decoration: none;
        }
        .mytaobao-bd
        {
            border: 1px solid #D5E5F5;
            box-shadow: 0 1px 3px #E9E9E9;
        }
        #mytaobao-panel .main-wrap #main-content
        {
        }
        #main-content
        {
            position: relative;
            border: 1px solid #C4D5E0;
            padding: 10px;
            margin-top: 10px;
        }
        
        .msg-bar
        {
            margin-bottom: 10px;
        }
        .msg:after, .msg24:after
        {
            clear: both;
            content: " ";
            display: block;
            height: 0;
        }
        .msg-bar p
        {
            float: none !important;
        }
        .msg .tips, .msg .attention, .msg .help, .msg .ok, .msg .alert
        {
            background: url("http://img01.taobaocdn.com/tps/i1/T1CqmcXllwXXXXXXXX-64-1800.png") no-repeat scroll 0 0 transparent;
            border: 1px solid #DDDDDD;
            color: #404040;
            float: left;
            line-height: 18px;
            padding: 2px 10px 2px 23px;
        }
        .msg .attention
        {
            background-color: #E5F5FF;
            background-position: 3px -147px;
            border-color: #40B3FF;
        }
        .notice-group
        {
            overflow: hidden;
        }
        .msg .notice
        {
            background: url("http://a.tbcdn.cn/sys/common/img/msg_bg.png") no-repeat scroll 5px -295px transparent;
            color: #404040;
            float: left;
            line-height: 18px;
            padding: 2px 10px 2px 23px;
        }
        .data-list .hd
        {
            height: 31px;
            position: relative;
            z-index: 2;
        }
        .data-list .tabs
        {
            left: 20px;
            overflow: hidden;
            position: relative;
        }
        .data-list .tabs
        {
            left: 20px;
            overflow: hidden;
            position: relative;
        }
        
        .data-list .tabs li, .data-list .tabs li a
        {
            background: url("http://a.tbcdn.cn/app/trade/img/tabview_bg_flexible.png") no-repeat scroll 0 0 transparent;
        }
        .data-list .tabs li
        {
            background-position: 0 8px;
            cursor: pointer;
            float: left;
            height: 29px;
            line-height: 21px;
            margin-right: 3px;
            padding: 8px 0 0;
            text-align: center;
        }
        .data-list .tabs li
        {
            background-position: 0 8px;
            cursor: pointer;
            float: left;
            height: 29px;
            line-height: 21px;
            margin-right: 3px;
            padding: 8px 0 0;
            text-align: center;
        }
        .data-list .tabs .selected
        {
            background-position: 0 -43px;
        }
        .data-list .tabs li a
        {
            background-position: right -24px;
            color: black;
            float: left;
            height: 24px;
            padding: 0 12px;
        }
        .data-list .tabs .selected a
        {
            background-color: transparent;
            background-position: right -75px;
            cursor: default;
            font-weight: bold;
            height: 24px;
            margin-top: -3px;
            padding-top: 3px;
        }
        .data-list .bd
        {
            border-top: 1px solid #AED2FF;
            clear: both;
            left: 0;
            position: relative;
        }
        .data-list .bd
        {
            border-top: medium none;
        }
        .search-form
        {
            border-top: 1px solid #AED2FF;
            clear: both;
            padding: 8px 15px 2px;
        }
        .search-form p
        {
            font-family: '宋体' ,Tahoma,Helvetica,Arial,sans-serif0;
            padding-bottom: 6px;
        }
        .search-form label
        {
            display: inline-block;
            text-align: right;
            width: 60px;
        }
        .search-form p input
        {
            font-family: '宋体' ,Tahoma,Helvetica,Arial,sans-serif0;
        }
        .search-form input#search-keyword
        {
            margin-right: 40px;
            width: 154px;
        }
        .search-form #first-cate-id
        {
            height: 20px;
            width: 156px;
        }
        .search-form input#outer-id
        {
            margin-right: 40px;
            width: 148px;
        }
        .search-form input#search-price-from, .search-form input#search-price-to, .search-form input#search-num-from, .search-form input#search-num-to
        {
            width: 60px;
        }
        .search-form input#search-price-to
        {
            margin-right: 45px;
            width: 64px;
        }
        .search-form #search-num-to
        {
            margin-right: 160px;
        }
        .search-form .search-btn, .search-form .stock-search-btn
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 0 0 transparent;
            border: medium none;
            height: 24px;
            padding: 2px 20px;
            width: 70px;
        }
        .data-list .list-head
        {
            background-color: #FFFFFF;
            border-top: 1px solid #AED2FF;
        }
        .data-list .bd table
        {
            border-collapse: collapse;
            table-layout: fixed;
            width: 750px;
        }
        #main-content .data-list table
        {
            width: 100%;
        }
        .data-list th
        {
            font-weight: normal;
        }
        .data-list .list-head th
        {
            background: url("http://a.tbcdn.cn/app/trade/img/itemlist_bg.gif") repeat-x scroll 0 0 transparent;
            border-bottom: 1px solid #AEC7E5;
            color: #000000;
            height: 29px;
            text-align: center;
        }
        .data-list .list-head th .order-by-gray-desc
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 48px -192px transparent;
            display: inline-block;
            padding-right: 12px;
            text-align: right;
            width: 48px;
        }
        .data-list .list-head th .order-by-gray-asce
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 48px -175px transparent;
            display: inline-block;
            padding-right: 12px;
            text-align: right;
            width: 48px;
        }
        .data-list .list-head th .order-by-desc
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 48px -228px transparent;
            display: inline-block;
            padding-right: 12px;
            text-align: right;
            width: 48px;
        }
        .data-list .list-head th .order-by-asce
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 48px -211px transparent;
            display: inline-block;
            padding-right: 12px;
            text-align: right;
            width: 48px;
        }
        .data-list .list-head .operation-tool
        {
            padding: 4px 0 2px;
        }
        .data-list .operations
        {
            -moz-border-bottom-colors: none;
            -moz-border-image: none;
            -moz-border-left-colors: none;
            -moz-border-right-colors: none;
            -moz-border-top-colors: none;
            background: none repeat scroll 0 0 #F3F3F3;
            border-color: #DEDEE0;
            border-style: solid;
            border-width: 1px 0;
            height: 28px;
            line-height: 28px;
            text-align: left;
            width: 100%;
        }
        .data-list .operations label
        {
            color: #404040;
            margin-right: 18px;
        }
        .data-list .trigger-btn
        {
            margin-right: 8px;
            text-align: center;
            vertical-align: middle;
        }
        .data-list .data td
        {
            border-bottom: 1px solid #DDDDDD;
            padding: 12px 0;
            text-align: center;
        }
        #main-content .data-list .with-sid td
        {
            padding: 12px 0 8px;
        }
        #main-content .data-list .with-sid td
        {
            border-bottom: medium none;
        }
        #main-content .data-list .goods-sid td
        {
            background-color: #E8F2FF;
            border-bottom: medium none;
            border-top: 1px solid #D4E7FF;
            padding: 0;
            text-align: left;
        }
        .data-list .stock-selector
        {
            margin-left: 0;
        }
        .data-list .data td img
        {
            vertical-align: middle;
        }
        .data-list .data .item-pic
        {
            border: 1px solid #CDCDCD;
            display: block;
            height: 52px;
            width: 52px;
        }
        .data-list .data .desc .item-title-area
        {
            height: 36px;
            width: 100%;
        }
        .data-list .data .desc .new-item-title
        {
            height: 32px;
            width: 200px;
        }
        .data-list .data .edit-save
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 0 -55px transparent;
            border: medium none;
            color: #404040;
            display: block;
            height: 20px;
            line-height: 20px;
            margin: 0 auto;
            text-align: center;
            width: 41px;
        }
        .data-list .data .desc .edit-save
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 0 -55px transparent;
            border: medium none;
            display: block;
            height: 20px;
            margin-left: 163px;
            width: 41px;
        }
        
        .data-list .data .desc p
        {
            height: 36px;
            overflow: hidden;
            width: 100%;
            word-wrap: break-word;
        }
        .data-list .high-light
        {
            background-color: #FFFFD3;
            cursor: pointer;
        }
        .data-list .data .desc .edit-item-title
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 5px -84px transparent;
            display: block;
            height: 18px;
            margin-left: 180px;
            margin-top: -18px;
            overflow: hidden;
            text-indent: -9999px;
            width: 24px;
        }
        
        .data-list .data .desc .item-cate
        {
            color: #FF6600;
            height: 18px;
            line-height: 18px;
            margin-top: 0;
            width: 180px;
        }
        #main-content .data-list td.price-row
        {
            text-align: right;
        }
        
        .data-list .item-SKU-price-area, .data-list .item-price-area
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 138px -84px transparent;
            padding-right: 20px;
        }
        .data-list .price-row p
        {
            padding-right: 20px;
            text-align: right;
        }
        .data-list .price-now
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll -52px -84px transparent;
            color: #FF6600;
            display: inline-block;
            font-family: tahoma;
            font-size: 14px;
            font-weight: 700;
            padding-left: 12px;
            padding-right: 6px;
        }
        .data-list .high-light
        {
            background-color: #FFFFD3;
            cursor: pointer;
        }
        .recommend-tips
        {
            padding: 30px 0 10px;
        }
        .recommend-tips em
        {
            color: #FF6600;
            font-weight: bold;
        }
        .data-list .data .copy-link
        {
            background: url("http://img04.taobaocdn.com/tps/i4/T1mgF3XblGXXXXXXXX-100-300.png") no-repeat scroll 0 -30px transparent;
            border: medium none;
            color: #AAAAAA;
            display: block;
            height: 20px;
            margin: 0 auto;
            outline: medium none;
            padding-bottom: 2px;
            width: 64px;
        }
    </style>
}
@section Scripts
{
    <script src="../../Scripts/public.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {

            GetGood();

            $(document).click(function (e) {
                hidetype(e);
            })

        });
        function hidetype(e) {
            var evt = e ? e : (window.event ? window.event : null); //此方法为了在firefox中的兼容
            var node = evt.srcElement ? evt.srcElement : evt.target; //evt.target在火狐上才能识别用的

            if (node.className == "edit-item-title" || node.className == "item-title-area-p") return;

            $(".item-title-area p").show()
            $(".edit-item-title").show();
            $(".surplus-words").hide();
        }
        function GetGood() {

            $.post("/goods/GetGoods", $("#open").serialize(), creatUI, "json");
        }
        function titleaddlight(obj) {
            $(obj).parent().addClass("high-light");

        }
        function titleremovelight(obj) {
            $(obj).parent().removeClass("high-light");
        }
        function editTitle(obj) {

            $(".item-title-area p").show();
            $(".item-title-area .edit-item-title").show();
            $(".item-title-area .surplus-words").hide();


            $(obj).parent().children("p").hide()
            $(obj).parent().children(".edit-item-title").hide();

            $(obj).parent().children(".surplus-words").show();

            Common.setlocatePoint($(obj).parent().find(".new-item-title").attr("id"));
        }
        function caleditTitle(obj) {

            $(obj).parent().parent().children("p").show()
            $(obj).parent().parent().children(".edit-item-title").show();
            $(obj).parent().parent().children(".surplus-words").hide();

        }
        function SaveTitle(obj) {
            var title=$(obj).parent().parent().find("a.item-title").text();
            var newtitle = $(obj).parent().find(".new-item-title").val();
          
            if (title != newtitle) {
              
                var id = $(obj).parent().find(".new-item-title").attr("id");
                $.post("/goods/SaveTitle", { id: id, title: newtitle }, function (data) {

                    if (data.ResultCode == "00") {
                        $(obj).parent().parent().find("a.item-title").text(newtitle);
                    }
                    else {

                    }
                }, "json");
            }
            caleditTitle(obj);
        }

        function creatUI(data) {

            var dataList = data.list;


            var tboby = "";
            var paget = "";
            var pageb = "";

            var currentIndex = parseInt(data.currentIndex);
            $("#currentIndex").val(data.currentIndex);
            var totalPages = parseInt(data.totalPages);
            $("#OrderList tbody").slice(1).remove();

            if (dataList != null && dataList.length > 0) {

                for (var i = 0; i < dataList.length; i++) {

                    var good = dataList[i];
                    tboby += '<tr class="goods-sid">';
                    tboby += '<td colspan="8">';
                    tboby += '   <input name="selectedIds" id="selectedIds:' + good.GID + '" class="selector stock-selector" value="' + good.GID + '"  type="checkbox">';
                    tboby += '</td></tr>';
                    tboby += '<tr class="with-sid">';
                    tboby += '<td>';
                    tboby += '<a href="item.htm?id=' + good.GID + '" target="_blank" title="' + good.Title + '">';
                    tboby += '<img src="' + good.ImgUrl + '" alt="图片描述信息" class="item-pic">';
                    tboby += '</a>';
                    tboby += '  </td>';
                    tboby += '<td class="desc">';
                    tboby += ' <div title="编辑宝贝标题" class="item-title-area">';
                    tboby += '<p class="item-title-area-p" onclick="editTitle(this)"  style="" onmouseout="titleremovelight(this)" onmousemove="titleaddlight(this)"> <a title="' + good.Title + '" target="_blank" href="item.htm?id=' + good.GID + '" class="item-title">' + good.Title + '</a></p>';
                    tboby += '<a onclick="editTitle(this)" class="edit-item-title" onmouseout="titleremovelight(this)" onmousemove="titleaddlight(this)" href="#;" title="编辑宝贝标题"  style="">编辑宝贝标题</a>';
                    tboby += '<span  class="surplus-words" style=" display:none"> ';
                    tboby += ' <textarea  id="' + good.GID + '" class="new-item-title edit-area" rows="2">' + good.Title + '</textarea>';
                    tboby += ' <a class="edit-save" onclick="SaveTitle(this)" href="#;">保存</a>';
                    tboby += ' </div>';
                    tboby += ' <div class="item-cate"></div>';
                    tboby += ' </td>';
                    tboby += '<td class="price-row">';
                    tboby += '  <p class="item-SKU-price-area" title="编辑价格" data-url="edit_price_SKU_frame.htm?itemIds=' + good.GID + '">';
                    tboby += '<span class="price-now" id="itemId:' + good.GID + '">' + good.SalePRICE.toFixed(2) + ' </span> </p>';
                    tboby += ' </td>';
                    tboby += '<td>';
                    tboby += '<input name="goods_num:19384804729" id="goods_num:19384804729" value="1" size="4" maxlength="6" type="hidden"/>';
                    tboby += '<input name="stuff_status:19384804729" id="stuff_status:19384804729" value="5" type="hidden"/>';
                    tboby += ' <input name="prepayCat:19384804729" id="prepayCat:19384804729" value="false" type="hidden">';
                    tboby += '' + good.STOCKS + '<br>';
                    tboby += ' <input name="event_submit_do_up_shelf_single" id="upShelfSingle" value="上架" onclick="return singleUpShelf()" type="submit"/>';
                    tboby += '</td>';
                    tboby += '<td>' + good.SaleCount + '</td>';
                    tboby += '<td>' + good.AddTime + '</td>';
                    tboby += ' <td>' + good.EndTime + '</td>';
                    tboby += '<td><a>编辑宝贝</a> <a title="此功能只能在IE下使用" class="copy-link" href="http://item.taobao.com/item.htm?id=19384804729">复制链接</a>';
                    tboby += '</td>';
                    tboby += '</tr>';
                }
            }

            $("#goodlist tbody.data").html(tboby);
        }
       
    </script>
}
<div class="main pageWidth pb">
    @{Html.RenderAction("TopNav", "Member", new { pageType = 2 });}
    <div class="clearself">
        <div class="left">
            @{Html.RenderAction("MemberMenu", "Member", new { pageType = 2 });}
        </div>
        <div class="right">
            <div class="position">
                <a href="#;">我是卖家</a> &gt; <a href="#;">商品管理</a> &gt; 仓库中的商品
            </div>
            <div id="main-content" class="mytaobao-bd">
                <div class="msg msg-bar">
                    <p class="attention">
                    </p>
                </div>
                <form name="open" id="open" method="post">
                <input name="pageName" value="goodsInStock" type="hidden">
                <input name="banner" value='@ViewData["banner"]' type="hidden">
                <input name="currentIndex" value="1" type="hidden">
                <input name="orderField" value="6" type="hidden">
                <input name="orderBy" value="1" type="hidden">
                <div class="notice-group">
                    <div class="msg">
                        <p class="notice naked">
                        </p>
                    </div>
                </div>
                <div class="data-list data-list-goods">
                    <div class="hd">
                        <ul class="tabs">
                            <li class="selected"><a href="/goods/goods_in_stock">等待上架的宝贝</a></li>
                            <li><a href="/goods/goods_in_stock?banner=5">全部卖完的宝贝</a></li>
                            <li><a href="/goods/goods_in_stock?banner=7">历史宝贝记录</a></li>
                        </ul>
                    </div>
                    <div id="J_DataTable" class="bd">
                        <div class="search-form" data-spm="1000777">
                            <p>
                                宝贝状态：<select name="state" onchange="changeState()">
                                    <option value="0" selected="selected">所有等待上架的</option>
                                    <option value="6">我下架的</option>
                                    <option value="3">定时上架的</option>
                                    <option value="4">从未上架的</option>
                                </select>
                            </p>
                            <p>
                                <label for="search-keyword">
                                    宝贝名称：</label>
                                <input name="title" id="search-keyword" maxlength="64" type="text">
                                <label for="outer-id">
                                    商家编码：</label>
                                <input name="outerId" id="outer-id" maxlength="64" type="text">
                                <label for="first-cate-id">
                                    一级类目：</label>
                                <select name="Category" id="first-cate-id">
                                    <option value="0" selected="selected">全部类目</option>
                                    <option value="16">女装/女士精品</option>
                                </select>
                            </p>
                            <p>
                                <label>
                                    价格：</label>
                                <input class="search-price" name="searchPriceFrom" id="search-price-from" type="text">&nbsp;到&nbsp;<input
                                    class="search-price" name="searchPriceTo" id="search-price-to" type="text">
                                <label>
                                    总销量：</label><input class="search-num" name="searchNumFrom" id="search-num-from" type="text">&nbsp;到&nbsp;<input
                                        class="search-num" name="searchNumTo" id="search-num-to" type="text">
                                <button type="submit" class="stock-search-btn" onclick="searchItems()" name="queryButton"
                                    id="queryButton">
                                    搜索</button>
                            </p>
                        </div>
                        <div data-spm="1000776" class="list-head">
                            <table>
                                <colgroup>
                                    <col width="58">
                                    <col width="205">
                                    <col width="155">
                                    <col width="85">
                                    <col width="80">
                                    <col width="80">
                                    <col width="80">
                                    <col width="75">
                                </colgroup>
                                <thead>
                                    <tr>
                                        <th>
                                        </th>
                                        <th>
                                            宝贝名称
                                        </th>
                                        <th class="price-head">
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;价格
                                        </th>
                                        <th class="num-head">
                                            &nbsp;&nbsp;库存
                                        </th>
                                        <th>
                                            <a id="sold-amount-label" title="总销量" class="order-by-gray-desc" href="javascript:orderByBidCount()">
                                                总销量</a>
                                        </th>
                                        <th>
                                            <a id="create-time-label" title="创建时间" class="order-by-gray-desc" href="javascript:orderByCreateTime()">
                                                创建时间</a>
                                        </th>
                                        <th>
                                            <a id="left-time-label" title="结束时间" class="order-by-desc" href="javascript:orderByEndsTime()">
                                                结束时间</a>
                                        </th>
                                        <th>
                                            操作
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td colspan="8" class="operation-tool">
                                            <div class="operations">
                                                <input name="operate" value="" type="hidden">
                                                <input id="all-select1" class="all-selector stock-selector" type="checkbox">
                                                <label for="all-select1">
                                                    全选</label>
                                                <button class="trigger-btn" type="button" onclick="javascript:deleteItem();">
                                                    删 除</button>
                                                <button class="trigger-btn" type="button" onclick="javascript: upShelf()">
                                                    上 架</button>
                                            </div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <table id="goodlist">
                            <colgroup>
                                <col width="58">
                                <col width="205">
                                <col width="155">
                                <col width="85">
                                <col width="80">
                                <col width="80">
                                <col width="80">
                                <col width="75">
                            </colgroup>
                            <tbody class="data">
                            </tbody>
                            <tbody class="act">
                                <tr class="sep-row">
                                    <td colspan="8">
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="8">
                                        <div class="operations">
                                            <input value="" name="operate" type="hidden">
                                            <input id="all-select2" class="all-selector stock-selector" type="checkbox">
                                            <label for="all-select2">
                                                全选</label>
                                            <input name="event_submit_do_delete" value="" type="hidden">
                                            <button class="trigger-btn" type="button" onclick="javascript:deleteItem();">
                                                删 除</button>
                                            <input name="event_submit_do_up_shelf" value="" type="hidden">
                                            <button class="trigger-btn" type="button" onclick="javascript: upShelf()">
                                                上 架</button>
                                            <button class="trigger-btn" type="button" onclick="javascript: gotoApplyTemplates(null, null);">
                                                设置运费</button>
                                            <button class="trigger-btn" type="button" onclick="javascript:gotoApplyBonus();">
                                                设置促销</button>
                                            <button class="trigger-btn" type="button" onclick="javascript: gotoApplyCharity();">
                                                公益捐赠</button>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="8">
                                        <div class="operations">
                                            <ul class="page-navb">
                                                <li>共有1条记录 | </li>
                                                <li class="prev-page"></li>
                                                <li class="curr-page"><a href="#" class="selected" onclick="javascript:gotoPage('1')">
                                                    1</a></li>
                                                <li>到第<input name="pageNO" size="2" maxlengh="4" tabindex="200" id="pageNO" type="text">页
                                                    <input name="Submit22" id="viewit" value="确定" onclick="return gotoPage(document.forms['open'].elements['pageNO'].value)"
                                                        type="button"></li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="recommend-tips">
                        <b>备注：</b> 您可以将希望上架出售的宝贝打勾，然后按 <em>“上架”</em> 的确认键， 您的宝贝马上就会和大家见面了。
                        <br>
                    </div>
                </div>
                </form>
            </div>
        </div>
    </div>
</div>
